package com.ve.s2g.util

import com.natpryce.konfig.Key
import com.natpryce.konfig.stringType
import com.ve.s2g.chain.AbstractHandler
import com.ve.s2g.getS2gConfig

object Constants {
    val HANDLERS: String by lazy {
        getCommonConfig("handlers")
    }
    val SVN_URL: String by lazy {
        getCommonConfig("svn_url")
    }
    val SVN_USERNAME: String by lazy {
        getCommonConfig("svn_username")
    }
    val SVN_PASSWORD: String by lazy {
        getCommonConfig("svn_password")
    }
    val SVN_WRITE_LIST: String by lazy {
        getCommonConfig("svn_writelist")
    }
    val GITLAB_PRIVATE_TOKEN: String by lazy {
        getCommonConfig("gitlab_private_token")
    }
    val GITLAB_URL: String by lazy {
        getCommonConfig("gitlab_url")
    }
    val GITLAB_NAMESPACE_CONFIG: String by lazy {
        getCommonConfig("gitlab_namespace_config")
    }
    val SVN_PATH_LIST: String by lazy {
        getCommonConfig("svn_path_list")
    }
    val LOCAL_GIT_ROOT_PATH: String by lazy {
        getCommonConfig("local_git_root_path")
    }

    private fun getCommonConfig(key: String): String {
        return getS2gConfig()!![Key("${AbstractHandler.prefix}.common.${key}", stringType)]
    }
}

fun main(args: Array<String>) {
    println(Constants.GITLAB_NAMESPACE_CONFIG)
}